package com.yuwubao.uav.tool.service.impl;

import com.yuwubao.framework.bean.PageData;
import com.yuwubao.uav.tool.mapper.FrontMapper;
import com.yuwubao.uav.tool.mapper.UserMapper;
import com.yuwubao.uav.tool.service.FrontService;
import com.yuwubao.uav.tool.util.StringUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 */
@Service
public class FrontServiceImpl implements FrontService {

    private static final Logger logger = LogManager.getLogger(FrontServiceImpl.class.getName());

    @Resource
    private FrontMapper frontMapper;


    @Override
    public List<PageData> listFile(PageData pageData) throws Exception {
        try{
            return frontMapper.listFile(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listFileCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listFileCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listViewpointTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listViewpointTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listViewpoint(PageData pageData) throws Exception {
        try{
            return frontMapper.listViewpoint(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listViewpointCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listViewpointCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listTtResultTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listTtResultTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listTtResult(PageData pageData) throws Exception {
        try{
            return frontMapper.listTtResult(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listTtResultCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listTtResultCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listThinkTank(PageData pageData) throws Exception {
        try{
            return frontMapper.listThinkTank(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listThinkTankTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listThinkTankTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listThinkTankCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listThinkTankCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listSpecial(PageData pageData) throws Exception {
        try{
            return frontMapper.listSpecial(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listSpecialTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listSpecialTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listSpecialTypeFatherAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listSpecialTypeFatherAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listSpecialCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listSpecialCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }

    @Override
    public List<PageData> listSpecialG(PageData pageData) throws Exception {
        try{
            List<PageData> list = frontMapper.listSpecialG(pageData);
            if (list != null && list.size()>0) {
                for (PageData pd : list) {
                    if (pd.get("s_year") != null) {
                        pageData.put("s_year",pd.get("s_year"));
                        pd.put("list",frontMapper.listSpecialGDetail(pageData));
                    }
                }
            }
            return list;
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listSpecialGCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listSpecialGCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }

    @Override
    public List<PageData> listProfessor(PageData pageData) throws Exception {
        try{
            return frontMapper.listProfessor(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listProfessorCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listProfessorCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listPaternerTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listPaternerTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listPaterner(PageData pageData) throws Exception {
        try{
            return frontMapper.listPaterner(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listPaternerCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listPaternerCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listMedia(PageData pageData) throws Exception {
        try{
            return frontMapper.listMedia(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listMediaCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listMediaCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listHotNewsSlide(PageData pageData) throws Exception {
        try{
            return frontMapper.listHotNewsSlide(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listHotNews(PageData pageData) throws Exception {
        try{
            return frontMapper.listHotNews(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listHotNewsTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listHotNewsTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listHotNewsCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listHotNewsCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listForum(PageData pageData) throws Exception {
        try{
            return frontMapper.listForum(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listForumTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listForumTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listForumCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listForumCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listDecisionComment(PageData pageData) throws Exception {
        try{
            return frontMapper.listDecisionComment(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listDecisionCommentCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listDecisionCommentCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listDecision(PageData pageData) throws Exception {
        try{
            return frontMapper.listDecision(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public void addDecisionComment(PageData pageData) throws Exception {
        try{
            frontMapper.addDecisionComment(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public int listDecisionCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listDecisionCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listCourse(PageData pageData) throws Exception {
        try{
            return frontMapper.listCourse(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listCourseTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listCourseTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listCourseCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listCourseCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listAdvice(PageData pageData) throws Exception {
        try{
            return frontMapper.listAdvice(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listAdviceCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listAdviceCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listAdver(PageData pageData) throws Exception {
        try{
            return frontMapper.listAdver(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listAdverCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listAdverCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listFocusNews(PageData pageData) throws Exception {
        try{
            return frontMapper.listFocusNews(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listFocusNewsTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listFocusNewsTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listFocusNewsCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listFocusNewsCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public PageData getAllianceInfo(PageData pageData) throws Exception {
        try{
            return frontMapper.getAllianceInfo(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getOrgInfo(PageData pageData) throws Exception {
        try{
            return frontMapper.getOrgInfo(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }

    @Override
    public List<PageData> listAllianceActivity(PageData pageData) throws Exception {
        try{
            return frontMapper.listAllianceActivity(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listAllianceActivityCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listAllianceActivityCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listOrgDynamic(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgDynamic(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listOrgDynamicCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgDynamicCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }

    @Override
    public List<PageData> listAllianceMember(PageData pageData) throws Exception {
        try{
            return frontMapper.listAllianceMember(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }

    @Override
    public List<PageData> listOrgProject(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgProject(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listOrgProjectTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgProjectTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listOrgProjectCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgProjectCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }

    @Override
    public List<PageData> listOrgResult(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgResult(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listOrgResultTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgResultTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listOrgResultCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgResultCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listOrgPublish(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgPublish(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listOrgPublishTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgPublishTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listOrgPublishCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgPublishCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listOrgJg(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgJg(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listOrgJgCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgJgCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listOrgLeader(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgLeader(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listOrgLeaderCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrgLeaderCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listQuestionnaire(PageData pageData) throws Exception {
        try{
            return frontMapper.listQuestionnaire(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listQuestionnaireCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listQuestionnaireCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listEvaluationTypeAll(PageData pageData) throws Exception {
        try{
            return frontMapper.listEvaluationTypeAll(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public List<PageData> listEvaluation(PageData pageData) throws Exception {
        try{
            return frontMapper.listEvaluation(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listEvaluationCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listEvaluationCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listGNThinktank(PageData pageData) throws Exception {
        try{
            return frontMapper.listGNThinktank(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listGNThinktankCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listGNThinktankCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }

    @Override
    public List<PageData> listOrg(PageData pageData) throws Exception {
        try{
            return frontMapper.listOrg(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public void clickOrgDynamic(PageData pageData) throws Exception {
        try{
            frontMapper.clickOrgDynamic(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void clickOrgProject(PageData pageData) throws Exception {
        try{
            frontMapper.clickOrgProject(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void clickOrgPublish(PageData pageData) throws Exception {
        try{
            frontMapper.clickOrgPublish(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void clickOrgResult(PageData pageData) throws Exception {
        try{
            frontMapper.clickOrgResult(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void clickTtResult(PageData pageData) throws Exception {
        try{
            frontMapper.clickTtResult(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void clickViewpoint(PageData pageData) throws Exception {
        try{
            frontMapper.clickViewpoint(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void addDecisionResponse(PageData pageData) throws Exception {
        try{
            frontMapper.addDecisionResponse(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void answerQuestionnaire(PageData pageData) throws Exception {
        try{
            frontMapper.answerQuestionnaire(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void updateQResponseCount(PageData pageData) throws Exception {
        try{
            frontMapper.updateQResponseCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void updateQSubjectResponseCount(PageData pageData) throws Exception {
        try{
            frontMapper.updateQSubjectResponseCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void updateQOptionResponseCount(PageData pageData) throws Exception {
        try{
            frontMapper.updateQOptionResponseCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public void updateQContentResponseCount(PageData pageData) throws Exception {
        try{
            frontMapper.updateQContentResponseCount(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public PageData getQuestionnaireInfo(PageData pageData) throws Exception {
        PageData rePd = null;
        try{

            rePd = frontMapper.getQInfo(pageData);

            if (rePd != null) {
                List<PageData> subjectList = frontMapper.listQSubject(rePd);

                if (subjectList != null && subjectList.size() > 0) {
                    for (PageData spd : subjectList) {
                        spd.put("optionList",frontMapper.listQSOption(spd));
                    }
                }

                rePd.put("subjectList",subjectList);
            }

        }catch (Exception e) {
            logger.debug("",e);
        }
        return rePd;
    }

    @Override
    public void addTotalTimes() throws Exception {
        try{
            frontMapper.addTotalTimes();
        }catch (Exception e) {
            logger.debug("",e);
        }
    }
    @Override
    public PageData findById(int id) throws Exception {
        try{
            return frontMapper.findById(id);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }

    @Resource
    private UserMapper userMapper;

    /**
     * 处理用户浏览记录和收藏操作
     * @param pageData1
     * @param pageData
     * @throws Exception
     */
    public void excuteUserActive(PageData pageData1,PageData pageData) throws Exception {
        if (pageData.get("userId") != null && !"".equals(pageData.get("userId").toString())) {

            //创建用户浏览记录
            if (pageData1.get("title") != null && !"".equals(pageData1.get("title"))) {
                pageData.put("title", pageData1.get("title"));

                if (frontMapper.getUserBrowsingHistory(pageData) > 0) {
                    frontMapper.updateUserBrowsingHistory(pageData);
                } else {
                    frontMapper.addUserBrowsingHistory(pageData);
                }

                //处理用户浏览积分
                pageData.put("title","浏览新闻积分");
                pageData.put("sType","browser_integration");
                pageData.put("integration",userMapper.getPublishIntegration(pageData));
                userMapper.addUserPublishIntegration(pageData);
            }

            //处理用户收藏操作
            if (pageData.get("flag") != null && "1".equals(pageData.get("flag"))) {
                String collectionFlag = frontMapper.getCollectionFlag(pageData);
                if (StringUtil.isNotNvlOrBlank(collectionFlag)) {
                    if ("1".equals(collectionFlag)) {
                        pageData.put("isCollection","0");
                    } else {
                        pageData.put("isCollection","1");
                    }
                    frontMapper.updateUserCollection(pageData);
                } else {
                    frontMapper.addUserCollection(pageData);
                }

            }


        }
    }

    @Override
    public PageData getLearningMaterials(PageData pageData) throws Exception {
        try {
            PageData pageData1 = frontMapper.getLearningMaterials(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_learning_materials");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }

            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;
        } catch (Exception e) {
            logger.debug("", e);
        }
        return null;
    }
    @Override
    public PageData getEvaluation(PageData pageData) throws Exception {
        try {
            PageData pageData1 = frontMapper.getEvaluation(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_evaluation");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;
        } catch (Exception e) {
            logger.debug("", e);
        }
        return null;
    }
    @Override
    public PageData getFileInfo(PageData pageData) throws Exception {
        try{

            PageData pageData1 = frontMapper.getFileInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_file");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getViewpointInfo(PageData pageData) throws Exception {
        try{

            PageData pageData1 = frontMapper.getViewpointInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_viewpoint");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getTtResultInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getTtResultInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_tt_result");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getThinkTankInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getThinkTankInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_thinktank");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getSpecialInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getSpecialInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_special");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getProfessorInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getProfessorInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_professor");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getPaternerInfo(PageData pageData) throws Exception {
        try{
            pageData.put("tableName","t_paterner");
            frontMapper.updateClickTimes(pageData);
            return frontMapper.getPaternerInfo(pageData);

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getMediaInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getMediaInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_media");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getHotNewsInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getHotNewsInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_hot_news");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getForumInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getForumInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_forum");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getDecisionInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getDecisionInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_decision");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getDecisionCommentInfo(PageData pageData) throws Exception {
        try{
            return frontMapper.getDecisionCommentInfo(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getCourseInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getCourseInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_course");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getAdviceInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getAdviceInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_advice");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getAdverInfo(PageData pageData) throws Exception {
        try{
            pageData.put("tableName","t_adver");
            frontMapper.updateClickTimes(pageData);
            return frontMapper.getAdverInfo(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getAllianceActivityInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getAllianceActivityInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_alliance_activity");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getFocusNewsInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getFocusNewsInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_focus_news");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getOrgDynamicInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getOrgDynamicInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_tt_org_dynamic");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getOrgProjectInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getOrgProjectInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_tt_org_project");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getOrgResultInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getOrgResultInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_tt_org_result");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getOrgPublishInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getOrgPublishInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_tt_org_publish");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getOrgJgInfo(PageData pageData) throws Exception {
        try{
        PageData pageData1 = frontMapper.getOrgJgInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_tt_org_jg");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getOrgLeaderInfo(PageData pageData) throws Exception {
        try{
            PageData pageData1 = frontMapper.getOrgLeaderInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_tt_org_leader");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getUserPublishInfo(PageData pageData) throws Exception {
        try{
            PageData pageData1 = frontMapper.getUserPublishInfo(pageData);

            try {
            if (pageData1 != null ) {

                //更新浏览量
                pageData.put("tableName", "t_user_publish");
                frontMapper.updateClickTimes(pageData);

                excuteUserActive(pageData1,pageData);
            }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return pageData1;

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }


    @Override
    public PageData getUserPwdByMail(PageData pageData) throws Exception {
        try{
            return frontMapper.getUserPwdByMail(pageData);
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public PageData getSystemInfo() throws Exception {
        try{
            return frontMapper.getSystemInfo();
        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }

    @Override
    public List<PageData> listLearningMaterials(PageData pageData) throws Exception {
        try{
            return frontMapper.listLearningMaterials(pageData);

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listLearningMaterialsCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listLearningMaterialsCount(pageData);

        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public List<PageData> listUserPublish(PageData pageData) throws Exception {
        try{
            return frontMapper.listUserPublish(pageData);

        }catch (Exception e) {
            logger.debug("",e);
        }
        return null;
    }
    @Override
    public int listUserPublishCount(PageData pageData) throws Exception {
        try{
            return frontMapper.listUserPublishCount(pageData);

        }catch (Exception e) {
            logger.debug("",e);
        }
        return 0;
    }
    @Override
    public void lh(PageData pageData) throws Exception {
        try{
            int userId = frontMapper.getUserIdByPublic(pageData);
            if (userId > 0) {
                pageData.put("lhUserId",userId);
                frontMapper.addLh(pageData);
            }
        }catch (Exception e) {
            logger.debug("",e);
        }
    }


}
